<?php

class ResourcePhysical extends BaseModel 
{
	/**
     * Returns the static model of the specified AR class.
     * @return CActiveRecord the static model class
     */
    public static function model($className=__CLASS__)
    {
		return parent::model($className);
    }
	
	/**
     * @return string the associated database table name
     */
    public function tableName()
    {
		return 'resource_physical';
    }
    
	public function rules()
    {
        return array(
            array('physical_name, res_id, physical_type, storage, system_id, partition_format, keep_days', 'required', 'message'=>'{attribute} 不能为空'),
        );
    }
    
    public function attributeLabels()
    {
        return array(
            'physical_id' => '编号',
            'physical_name' => '物理资源',
            'res_id' => '逻辑资源',
            'physical_type' => '类型',
            'system_id' => '存储系统',
            'storage' =>  '存储定位',
            'partition_format' =>  '分区格式',
            'keep_days' =>  '保存天数',
        );
    }

    public function relations() {
        return array(
            'resource'   =>  array(self::BELONGS_TO, 'Resource', 'res_id', 'joinType' => 'INNER JOIN'),
            'system'   =>  array(self::BELONGS_TO, 'StorageSystem', 'system_id', 'joinType' => 'INNER JOIN'),
        );
    }

}
